From c1a3a8bd90d1d32c0d41116bb8b0628766f50ec3 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Thu, 18 Aug 2005 18:02:46 +0000 Subject: [PATCH] Fix emulated writable pagetable updates where access is less than a full pte and operation requires cmpxchg. Signed-off-by: Keir Fraser --- xen/arch/x86/mm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 70f58806c8..08a6a15dcb 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -3059,7 +3059,7 @@ static int ptwr_emulated_update( } /* Turn a sub-word access into a full-word access. */ - if (bytes != sizeof(physaddr_t)) + if ( bytes != sizeof(physaddr_t) ) { int rc; physaddr_t full; @@ -3076,6 +3076,10 @@ static int ptwr_emulated_update( val &= (((physaddr_t)1 << (bytes*8)) - 1); val <<= (offset)*8; val |= full; + /* Also fill in missing parts of the cmpxchg old value. */ + old &= (((physaddr_t)1 << (bytes*8)) - 1); + old <<= (offset)*8; + old |= full; } /* Read the PTE that maps the page being updated. */ -- 2.30.2